package com.hdsx.jxcsxm.log.controller;

import com.hdsx.jxcsxm.log.bean.SysLog;
import com.hdsx.jxcsxm.log.factory.OperateStrategyFactory;
import com.hdsx.jxcsxm.log.server.LoggingBranchServer;
import com.hdsx.webutil.struts.BaseActionSupport;
import com.opensymphony.xwork2.ActionInvocation;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import javax.servlet.http.HttpServletRequest;
/**
 * @author 占贤银
 * time 2023/8/15 16:10
 * description 生命之灯因热情而点燃，生命之舟因拼搏而前行
 */
@Scope("prototype")
@Controller
public class LoggingBranch extends BaseActionSupport implements Runnable {

    private ActionInvocation invocation;

    private HttpServletRequest request;

    private LoggingBranchServer server;

    public LoggingBranch(ActionInvocation invocation, HttpServletRequest request) {
        this.invocation = invocation;
        this.request = request;
    }

    public LoggingBranch(ActionInvocation invocation, HttpServletRequest request, LoggingBranchServer server) {
        this.invocation = invocation;
        this.request = request;
        this.server = server;
    }

    @Override
    public void run() {
        final SysLog sysLog = OperateStrategyFactory.getOperaStrategy(this.invocation, this.request);
        sysLog.setTitle(sysLog.getTitle().replaceAll("&gt;", ">"));
        boolean bl = false;
        if (sysLog != null) {
            bl = server.insertSysLog(sysLog);
        }
    }

    // /jxcsxm/jhcx/queryXmlist.do
}
